package com.example.demo.service.observe;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class CouponService {

    @Async
    @EventListener
    public void addCoupon(UserRegisterEvent event) {
        log.info("当前线程为：" + Thread.currentThread().getId());
        log.info("[addCoupon][给用户{}发送优惠券]", event.getUserName());
    }
}
